home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / sed-2_00.lha / sed-2.00 / configure < prev    next >
Text File  |  1993-07-15  |  12KB  |  463 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=sed.c
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114. if test -z "$CC"; then
  115.   echo checking for gcc
  116.   saveifs="$IFS"; IFS="${IFS}:"
  117.   for dir in $PATH; do
  118.     test -z "$dir" && dir=.
  119.     if test -f $dir/gcc; then
  120.       CC="gcc"
  121.       break
  122.     fi
  123.   done
  124.   IFS="$saveifs"
  125. fi
  126. test -z "$CC" && CC="cc"
  127.  
  128. # Find out if we are using GNU C, under whatever name.
  129. cat > conftest.c <<EOF
  130. #ifdef __GNUC__
  131.   yes
  132. #endif
  133. EOF
  134. ${CC-cc} -E conftest.c > conftest.out 2>&1
  135. if egrep yes conftest.out >/dev/null 2>&1; then
  136.   GCC=1 # For later tests.
  137. fi
  138. rm -f conftest*
  139.  
  140. echo checking how to run the C preprocessor
  141. if test -z "$CPP"; then
  142.   CPP='${CC-cc} -E'
  143.   cat > conftest.c <<EOF
  144.  
  145. #include <stdio.h>
  146. EOF
  147. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  148. if test -z "$err"; then
  149.   :
  150. else
  151.   CPP=/lib/cpp
  152. fi
  153. rm -f conftest*
  154. fi
  155.  
  156. # Make sure to not get the incompatible SysV /etc/install and
  157. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  158. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  159. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  160. if test -z "$INSTALL"; then
  161.   echo checking for install
  162.   saveifs="$IFS"; IFS="${IFS}:"
  163.   for dir in $PATH; do
  164.     test -z "$dir" && dir=.
  165.     case $dir in
  166.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  167.     *)
  168.       if test -f $dir/install; then
  169.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  170.       : # AIX
  171.     else
  172.       INSTALL="$dir/install -c"
  173.       INSTALL_PROGRAM='$(INSTALL)'
  174.       INSTALL_DATA='$(INSTALL) -m 644'
  175.       break
  176.     fi
  177.       fi
  178.       ;;
  179.     esac
  180.   done
  181.   IFS="$saveifs"
  182. fi
  183. INSTALL=${INSTALL-cp}
  184. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  185. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  186.  
  187. echo checking for minix/config.h
  188. cat > conftest.c <<EOF
  189.  
  190. #include <minix/config.h>
  191. EOF
  192. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  193. if test -z "$err"; then
  194.   MINIX=1
  195. fi
  196. rm -f conftest*
  197.  
  198. # The Minix shell can't assign to the same variable on the same line!
  199. if test -n "$MINIX"; then
  200.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  201.   DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  202.   DEFS="$DEFS -D_MINIX=1"
  203. fi
  204.  
  205. echo checking for POSIXized ISC
  206. if test -d /etc/conf/kconfig.d &&
  207.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  208. then
  209.   ISC=1 # If later tests want to check for ISC.
  210.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  211.   if test -n "$GCC"; then
  212.     CC="$CC -posix"
  213.   else
  214.     CC="$CC -Xp"
  215.   fi
  216. fi
  217.  
  218. echo checking for ANSI C header files
  219. cat > conftest.c <<EOF
  220.  
  221. #include <stdlib.h>
  222. #include <stdarg.h>
  223. #include <string.h>
  224. #include <float.h>
  225. EOF
  226. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  227. if test -z "$err"; then
  228.   # SunOS string.h does not declare mem*, contrary to ANSI.
  229. echo '#include <string.h>' > conftest.c
  230. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  231. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  232.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  233. cat > conftest.c <<EOF
  234. #include <ctype.h>
  235. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  236. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  237. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  238. int main () { int i; for (i = 0; i < 256; i++)
  239. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  240. exit (0); }
  241.  
  242. EOF
  243. eval $compile
  244. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  245.   DEFS="$DEFS -DSTDC_HEADERS=1"
  246. fi
  247. rm -f conftest*
  248. fi
  249. rm -f conftest*
  250.  
  251. fi
  252. rm -f conftest*
  253.  
  254. for hdr in string.h
  255. do
  256. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  257. echo checking for ${hdr}
  258. cat > conftest.c <<EOF
  259.  
  260. #include <${hdr}>
  261. EOF
  262. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  263. if test -z "$err"; then
  264.   DEFS="$DEFS -D${trhdr}=1"
  265. fi
  266. rm -f conftest*
  267. done
  268.  
  269. echo checking for vprintf
  270. cat > conftest.c <<EOF
  271.  
  272. main() { exit(0); } 
  273. t() { vprintf(); }
  274. EOF
  275. if eval $compile; then
  276.   DEFS="$DEFS -DHAVE_VPRINTF=1"
  277. else
  278.   vprintf_missing=1
  279. fi
  280. rm -f conftest*
  281.  
  282. if test -n "$vprintf_missing"; then
  283. echo checking for _doprnt
  284. cat > conftest.c <<EOF
  285.  
  286. main() { exit(0); } 
  287. t() { _doprnt(); }
  288. EOF
  289. if eval $compile; then
  290.   DEFS="$DEFS -DHAVE_DOPRNT=1"
  291. fi
  292. rm -f conftest*
  293.  
  294. fi
  295.  
  296. for func in bcopy memcpy
  297. do
  298. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  299. echo checking for ${func}
  300. cat > conftest.c <<EOF
  301. #include <stdio.h>
  302. main() { exit(0); } 
  303. t() { 
  304. #ifdef __stub_${func}
  305. choke me
  306. #else
  307. /* Override any gcc2 internal prototype to avoid an error.  */
  308. extern char ${func}(); ${func}();
  309. #endif
  310.  }
  311. EOF
  312. if eval $compile; then
  313.   DEFS="$DEFS -D${trfunc}=1"
  314. fi
  315. rm -f conftest*
  316. #endif
  317. done
  318.  
  319. prog='/* Ultrix mips cc rejects this.  */
  320. typedef int charset[2]; const charset x;
  321. /* SunOS 4.1.1 cc rejects this. */
  322. char const *const *p;
  323. char **p2;
  324. /* HPUX 7.0 cc rejects these. */
  325. ++p;
  326. p2 = (char const* const*) p;'
  327. echo checking for working const
  328. cat > conftest.c <<EOF
  329.  
  330. main() { exit(0); } 
  331. t() { $prog }
  332. EOF
  333. if eval $compile; then
  334.   :
  335. else
  336.   DEFS="$DEFS -Dconst="
  337. fi
  338. rm -f conftest*
  339.  
  340. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  341. # for constant arguments.  Useless!
  342. echo checking for working alloca.h
  343. cat > conftest.c <<EOF
  344. #include <alloca.h>
  345. main() { exit(0); } 
  346. t() { char *p = alloca(2 * sizeof(int)); }
  347. EOF
  348. if eval $compile; then
  349.   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  350. fi
  351. rm -f conftest*
  352.  
  353. decl="#ifdef __GNUC__
  354. #define alloca __builtin_alloca
  355. #else
  356. #if HAVE_ALLOCA_H
  357. #include <alloca.h>
  358. #else
  359. #ifdef _AIX
  360.  #pragma alloca
  361. #else
  362. char *alloca ();
  363. #endif
  364. #endif
  365. #endif
  366. "
  367. echo checking for alloca
  368. cat > conftest.c <<EOF
  369. $decl
  370. main() { exit(0); } 
  371. t() { char *p = (char *) alloca(1); }
  372. EOF
  373. if eval $compile; then
  374.   :
  375. else
  376.   alloca_missing=1
  377. fi
  378. rm -f conftest*
  379.  
  380. if test -n "$alloca_missing"; then
  381.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  382.   # that cause trouble.  Some versions do not even contain alloca or
  383.   # contain a buggy version.  If you still want to use their alloca,
  384.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  385.   ALLOCA=alloca.o
  386. fi
  387.  
  388. if test -n "$prefix"; then
  389.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  390.   prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  391. fi
  392. if test -n "$exec_prefix"; then
  393.   prsub="$prsub
  394. s%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  395. fi
  396.  
  397. trap 'rm -f config.status; exit 1' 1 3 15
  398. echo creating config.status
  399. rm -f config.status
  400. cat > config.status <<EOF
  401. #!/bin/sh
  402. # Generated automatically by configure.
  403. # Run this file to recreate the current configuration.
  404. # This directory was configured as follows,
  405. # on host `(hostname || uname -n) 2>/dev/null`:
  406. #
  407. # $0 $*
  408.  
  409. if test \$# -gt 0; then
  410.   case "\$1" in
  411.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  412.     exec /bin/sh $0 $* ;;
  413.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  414.   esac
  415. fi
  416.  
  417. trap 'rm -f Makefile; exit 1' 1 3 15
  418. CC='$CC'
  419. CPP='$CPP'
  420. INSTALL='$INSTALL'
  421. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  422. INSTALL_DATA='$INSTALL_DATA'
  423. ALLOCA='$ALLOCA'
  424. LIBS='$LIBS'
  425. srcdir='$srcdir'
  426. DEFS='$DEFS'
  427. prefix='$prefix'
  428. exec_prefix='$exec_prefix'
  429. prsub='$prsub'
  430. EOF
  431. cat >> config.status <<\EOF
  432.  
  433. top_srcdir=$srcdir
  434. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  435.   srcdir=$top_srcdir
  436.   # Remove last slash and all that follows it.  Not all systems have dirname.
  437.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  438.   if test "$dir" != "$file"; then
  439.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  440.     test ! -d $dir && mkdir $dir
  441.   fi
  442.   echo creating $file
  443.   rm -f $file
  444.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  445.   sed -e "
  446. $prsub
  447. s%@CC@%$CC%g
  448. s%@CPP@%$CPP%g
  449. s%@INSTALL@%$INSTALL%g
  450. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  451. s%@INSTALL_DATA@%$INSTALL_DATA%g
  452. s%@ALLOCA@%$ALLOCA%g
  453. s%@LIBS@%$LIBS%g
  454. s%@srcdir@%$srcdir%g
  455. s%@DEFS@%$DEFS%
  456. " $top_srcdir/${file}.in >> $file
  457. fi; done
  458.  
  459. EOF
  460. chmod +x config.status
  461. test -n "$no_create" || ./config.status
  462.  
  463.